class_name MeleeMoonBlade
extends HoldMeleeWeapon


@onready var wave_start_point: Marker2D = $WaveStartPoint


func attack():
	super.attack()
	
	var player = holder as Player
	
	var wave_inst = (ResourceManager.get_resource("moon_blade_wave") as PackedScene).instantiate() as MoonBladeWave
	wave_inst.sender = holder
	wave_inst.attack = player.player_data.get_attack() + item_data.item_config.attack
	wave_inst.critical_rate = item_data.item_config.critical_rate
	wave_inst.critical_bonus = item_data.item_config.critical_bonus
	wave_inst.knockback = item_data.item_config.knockback
	wave_inst.hit_cam_shake_strength = item_data.item_config.attack_cam_shake_intensity
	wave_inst.hit_cam_shake_duration = item_data.item_config.attack_cam_shake_duration
	wave_inst.dir = Vector2.RIGHT * player.get_face()
	
	player.level.bullets_parent.add_child(wave_inst)
	wave_inst.set_is_enemy(false)
	wave_inst.global_position = wave_start_point.global_position
	wave_inst.scale.x = player.get_face()
